<script type="text/javascript" src="<?=APPLICATION_SITEADMIN_URL?>fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="<?=APPLICATION_SITEADMIN_URL?>fckeditor/ewp.js"></script>
<script type="text/javascript">
<!--
	_width_multiplier = 16;
	_height_multiplier = 30;
	var EW_DHTMLEditors = [];
	function EW_UpdateTextArea() {
		if (typeof EW_DHTMLEditors != 'undefined') {
			if (FCKeditorAPI) {
				var inst;			
				for (inst in FCKeditorAPI.__Instances)
					FCKeditorAPI.__Instances[inst].UpdateLinkedField();
			}
		}
	}

//-->
</script>


<?
	$mod = $_GET['mod'];
	if(isset($_GET['id'])) $id = $_GET['id'];
	else $id = 1;
	
	$db = new MySQL();
	$table = "contact";
	$sql = $db->select("select * from $table where id='$id'");
	if ($db->numrows($sql)>0)	
	$te = $db->fetch($sql);
	$db->close();
	$title_add = 'Edit "Contact"';
?>
<script type="text/JavaScript">
		
	function checkinput()
	{
		if(document.frmedit.email.value=="")
		{
			alert('Please enter email address for contact!');
			document.frmedit.email.focus();
			return false;
		}	
		if(!isEmail(document.frmedit.email.value)) 
		{
			alert("Email address isn't corect. Please enter email for contact again!");
			document.frmedit.email.focus();
			return false;
		}
		return true;
	}
	
	function save(id)
	{
		var frm=document.frmedit;		
		if(checkinput())
		{
			frm.action="?mod=<?=$mod?>&act=process&id="+id;
			frm.method="POST";
			frm.submit();
		}
	}
	
	function resetfrom()
	{
	   document.frmedit.reset();
	   
	}
	
	
	
	
</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	  <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="34"><img src="<?=APPLICATION_SITEADMIN_URL?>images/cor_data_top_l.gif" alt="tl" width="34" height="19" /></td>
			<td class="toptborder">&nbsp;</td>
			<td width="20"><img src="<?=APPLICATION_SITEADMIN_URL?>images/cor_data_top_r.gif" alt="tr" /></td>
		  </tr>
	  </table></td>
	</tr>
	<tr>
	  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="10" class="leftborder">&nbsp;</td>
			<td><table width="100%" border="0" cellpadding="0" cellspacing="2" class="dataBack">
			  <tr>
				<td width="55%" height="36" class="titleOrange"><?=$title_add?></td>
				<td align="right" valign="middle" class="titleOrange">&nbsp;</td>
			  </tr>
			  <tr>
				<td height="7" colspan="2" background="images/cor_data_line1.gif"></td>
			  </tr>
			  <tr>
				<form name="frmedit" method="post" enctype="multipart/form-data" >
				<td  colspan="2" ><table width="100%" border="0" cellspacing="0">	
				   <tr>
					<td width="19%" align="right" valign="top">Email : </td>
					<td ><input type="text" name="email" value="<?=$te['email']?>"  class="form_0" /></td>
				  </tr>	
				  <tr>
				    <td width="19%" align="right" valign="top">Menu Title : </td>
				    <td ><input name="titlemenu" type="text" class="form_0" value="<?=$te['titlemenu']?>" ></td>
				  </tr>	
				  
				  	 
				  <tr>
				    <td align="right" valign="top">Menu Title (Vietnamese) : </td>
				    <td ><input name="titlemenu_vn" type="text" class="form_0" value="<?=$te['titlemenu_vn']?>" ></td>
				  </tr>				  				   
				  <tr>
					<td align="right" valign="top">Image (290px*290px): </td>
					<td ><input type="file" name="image" />
					<?php
						if($te['image']!="" && file_exists("../contact-img/".$te['image']))
						{
							echo '<br/><img src="../contact-img/'.$te['image'].'"  />';
						}
					?></td>
				  </tr> 
				  
				  <!--
				  <tr>
				    <td align="right" valign="top">Title 1 : </td>
				    <td ><input name="title_1" type="text" class="form_0" value="<?=$te['title_1']?>" ></td>
				  </tr>	
				  <tr>
				    <td align="right" valign="top">Title 2 : </td>
				    <td ><input name="title_2" type="text" class="form_0" value="<?=$te['title_2']?>" ></td>
				  </tr>
				  -->
				  
				  <tr>
				    <td align="right" valign="top">Hotline : </td>
				    <td ><input name="hotline" type="text" class="form_0" value="<?=$te['hotline']?>" ></td>
				  </tr>
				  <tr>
				    <td align="right" valign="top">Description on Top: </td>
				    <td align="left" valign="middle">
					<SPAN class=hideTrigger><span id="aaaa" onClick="changeColor_02('aaaa')">English</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
					<SPAN class=hideTrigger><span id="bbbb" onClick="changeColor_02('bbbb')">Vietnamese</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
					
						<DIV  class=hideBlock id="aaaa_s">
						<P>
						<textarea name="description" class="form_2"><?=$te['description']?></textarea>
						<script type="text/javascript">
							var editor = new EW_DHTMLEditor("description");
							editor.create = function() {
								var sBasePath = '<?=APPLICATION_SITEADMIN_URL?>fckeditor/';
								var oFCKeditor = new FCKeditor('description', 40*_width_multiplier, 4*_height_multiplier);
								oFCKeditor.BasePath = sBasePath;
								oFCKeditor.ReplaceTextarea();
								this.active = true;
							}
							EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
						</script>		
						</P></DIV>
					
					
					<DIV  class=hideBlock id="bbbb_s">
						<P>
					<textarea name="description_vn" class="form_2"><?=$te['description_vn']?></textarea>
					<script type="text/javascript">
						var editor = new EW_DHTMLEditor("description_vn");
						editor.create = function() {
							var sBasePath = '<?=APPLICATION_SITEADMIN_URL?>fckeditor/';
							var oFCKeditor = new FCKeditor('description_vn', 40*_width_multiplier, 4*_height_multiplier);
							oFCKeditor.BasePath = sBasePath;
							oFCKeditor.ReplaceTextarea();
							this.active = true;
						}
						EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
					</script>					
					</P>
					</DIV>						
									
					<script type="text/javascript">
					changeColor_02('aaaa');
					</script>				</td>
			  	  </tr>					  
				  <!--
				  <tr>
				    <td align="right" valign="top">Description on Bottom : </td>
				    <td align="left" valign="middle">
					<SPAN class=hideTrigger><span id="aaaaa" onClick="changeColor_03('aaaaa')">English</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
					<SPAN class=hideTrigger><span id="bbbbb" onClick="changeColor_03('bbbbb')">Vietnamese</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
					
						<DIV  class=hideBlock id="aaaaa_s">
						<P>
						<textarea name="descriptionbt" class="form_2"><?=$te['descriptionbt']?></textarea>
						<script type="text/javascript">
							var editor = new EW_DHTMLEditor("descriptionbt");
							editor.create = function() {
								var sBasePath = '<?=APPLICATION_SITEADMIN_URL?>fckeditor/';
								var oFCKeditor = new FCKeditor('descriptionbt', 40*_width_multiplier, 4*_height_multiplier);
								oFCKeditor.BasePath = sBasePath;
								oFCKeditor.ReplaceTextarea();
								this.active = true;
							}
							EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
						</script>		
						</P></DIV>
					
					
					<DIV  class=hideBlock id="bbbbb_s">
						<P>
					<textarea name="descriptionbt_vn" class="form_2"><?=$te['descriptionbt_vn']?></textarea>
					<script type="text/javascript">
						var editor = new EW_DHTMLEditor("descriptionbt_vn");
						editor.create = function() {
							var sBasePath = '<?=APPLICATION_SITEADMIN_URL?>fckeditor/';
							var oFCKeditor = new FCKeditor('descriptionbt_vn', 40*_width_multiplier, 4*_height_multiplier);
							oFCKeditor.BasePath = sBasePath;
							oFCKeditor.ReplaceTextarea();
							this.active = true;
						}
						EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
					</script>					
					</P>
					</DIV>						
									
					<script type="text/javascript">
					changeColor_03('aaaaa');
					</script>				</td>
			  	  </tr>	
				  -->
				  <tr>
					<td align="right" valign="top">Content: </td>
					<td align="left" valign="middle">
						<SPAN class=hideTrigger><span id="aaa" onClick="changeColor('aaa')">English</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
						<SPAN class=hideTrigger><span id="bbb" onClick="changeColor('bbb')">Vietnamese</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;

						<DIV  class=hideBlock id="aaa_s">
							<P>
								<textarea name="content" class="form_2"><?= $te['content'] ?></textarea>
								<script type="text/javascript">
									var editor = new EW_DHTMLEditor("content");
									editor.create = function() {
									var sBasePath = '<?= APPLICATION_SITEADMIN_URL ?>fckeditor/';
									var oFCKeditor = new FCKeditor('content', 40*_width_multiplier, 15*_height_multiplier);
									oFCKeditor.BasePath = sBasePath;
									oFCKeditor.ReplaceTextarea();
									this.active = true;
									}
									EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
								</script>		
							</P></DIV>


						<DIV  class=hideBlock id="bbb_s">
							<P>
								<textarea name="content_vn" class="form_2"><?= $te['content_vn'] ?></textarea>
								<script type="text/javascript">
									var editor = new EW_DHTMLEditor("content_vn");
									editor.create = function() {
									var sBasePath = '<?= APPLICATION_SITEADMIN_URL ?>fckeditor/';
									var oFCKeditor = new FCKeditor('content_vn', 40*_width_multiplier, 15*_height_multiplier);
									oFCKeditor.BasePath = sBasePath;
									oFCKeditor.ReplaceTextarea();
									this.active = true;
									}
									EW_DHTMLEditors[EW_DHTMLEditors.length] = editor;
								</script>					
							</P>
						</DIV>					


						<script type="text/javascript">
							changeColor('aaa');
						</script>
					</td>
				</tr>	
				  
				  <!--  
				  <tr>
					<td align="right" valign="top">Google Map Script : </td>
					<td align="left" valign="middle">	
						<textarea name="map" class="form_2" style="height:300px"><?=$te['map']?></textarea></td>
				  </tr>				  
				  -->
				  
				  <tr>
				    <td align="right" valign="top">Thanks : </td>
				    <td align="left" valign="middle">
					<SPAN class=hideTrigger><span id="aaaaa" onClick="changeColor_03('aaaaa')">English</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
					<SPAN class=hideTrigger><span id="bbbbb" onClick="changeColor_03('bbbbb')">Vietnamese</span></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
					
						<DIV  class=hideBlock id="aaaaa_s">
						<P>
						<textarea name="thanks" class="form_2"><?=$te['thanks']?></textarea>
						</P></DIV>
											
						<DIV  class=hideBlock id="bbbbb_s">
							<P>
						<textarea name="thanks_vn" class="form_2"><?=$te['thanks_vn']?></textarea>
						</P>
						</DIV>						
									
					<script type="text/javascript">
					changeColor_03('aaaaa');
					</script>		</td>
			  	  </tr>
				  	
				  
				  <tr>
				    <td align="right" valign="top">Keywords : </td>
				    <td align="left" valign="middle">
					<textarea name="meta_key" class="form_3" ><?=$te['meta_key']?></textarea>					</td>
				  </tr> 
				   <tr>
				    <td align="right" valign="top">Description : </td>
				    <td align="left" valign="middle">
					<textarea name="meta_des" class="form_3"><?=$te['meta_des']?></textarea>					</td>
				  </tr> 
				  
				  <!--
				  <tr>
				    <td align="right" valign="top">Page Title : </td>
				    <td align="left" valign="middle">
					<textarea name="titlepage" class="form_3" ><?=$te['titlepage']?></textarea>					</td>
				  </tr> 
				  -->
				  <tr>
					<td width="23%" height="35" align="right" valign="top">&nbsp;</td>
					<td align="left" valign="middle">
					<input name="" type="button" onClick="save(<?=$id?>);" class="frmbnt" value="Save" /> &nbsp;
					<input name="" type="reset" class="frmbnt" value="Reset" onClick="resetfrom()" /></td>
				  </tr>
				</table>
				<input type="hidden" name="form_" value="edit">
				</td>
				</form>
			 </tr>
		   </table>
		   </td>
		   <td width="10" class="rightborder">&nbsp;</td>
		 </tr>
	  </table></td>
	</tr>
	<tr>
	  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="dataBack">
		  <tr>
			<td width="34"><img src="<?=APPLICATION_SITEADMIN_URL?>images/cor_data_bot_l.gif" alt="bl" /></td>
			<td class="botborder" >&nbsp;</td>
			<td width="19"><img src="<?=APPLICATION_SITEADMIN_URL?>images/cor_data_bot_r.gif" alt="br" /></td>
		  </tr>
	  </table></td>
	</tr>
</table>
<script type="text/javascript">
<!--
	EW_createEditor();  // Create DHTML editor(s)

//-->
</script>

